package com.xian.cloud.interceptor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @Author: xlr
 * @Date: Created in 下午9:00 2018/11/24
 */
@Component
public class FeginHandlerInterceptor implements HandlerInterceptor {

    private static final Logger log = LoggerFactory.getLogger( FeginHandlerInterceptor.class );

    @Override
    public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {

        String servletPath = httpServletRequest.getServletPath();
        System.out.println(servletPath);

        String token = httpServletRequest.getHeader( "Token" );

        log.info( "FeginHandlerInterceptor.preHandle.token:{}",token );
        return true;
    }

    @Override
    public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {

    }

    @Override
    public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {

    }
}

